﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Ball : MonoBehaviour
{
    public AudioSource m_Ding;
    Vector3 beforeFramePosition;
    public Vector3 direction;
    public Vector3 MoveDir = new Vector3(1f, 1f);
    public float increaseSpeed = 2 ;
    public float Speed = 1f;
    // Start is called before the first frame update
    void Start()
    {
        //transform.position = new Vector3(-1f,2f, 0);
    }
    // Update is called once per frame
    void Update()
    {
        Speed += increaseSpeed * Time.deltaTime;
        transform.position += MoveDir* Speed * Time.deltaTime;
        direction = transform.position - beforeFramePosition;
        direction = direction.normalized;
        beforeFramePosition = transform.position;


    }
    private void OnTriggerEnter(Collider other)
    {
        m_Ding.Play();
    }
}
